c,r[1<<20];f(a,b)int*a,*b;{*b>*a?c:c++;return*b>*a?-1:*b<*a;}main(n){for(;~scanf("%d",&n)&&n;c=0,qsort(r,n,4,f),printf("%d\n",c))for(c=0;c<n;scanf("%d",r+c++));}
